package itdep.domain.division;

import itdep.domain.CodedEntity;
import itdep.domain.TranslationType;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;

import javax.persistence.*;
import java.util.Set;

/**
 * @author Ivan Khalopik
 * @version $Revision: 10 $ $Date: 2010-06-16 07:13:04 +0000 (Wed, 16 Jun 2010) $
 */
@Entity
@Table(name = "SPECIALITY")
public class Speciality extends CodedEntity {

	@ManyToOne
	@JoinColumn(name = "ID_FACULTY", nullable = false)
	private Faculty faculty;

	@Type(type = "ga.hibernate.OrderedEnumUserType", parameters = {@Parameter(name = "enumClass", value = "itdep.domain.division.EducationForm")})
	@Column(name = "EDUCATION_FORM", nullable = false)
	private EducationForm educationForm;

	@Column(name = "SEMESTER_COUNT", nullable = false)
	private Integer semesterCount;

	@Column(name = "SPECIALITY_CODE", nullable = false)
	private String specialityCode;

	@Column(name = "SPECIALITY_CODING", nullable = false)
	private String specialityCoding;

	@OneToMany(mappedBy = "speciality")
	private Set<Specialization> specializations;

	public Speciality() {
		super("speciality", TranslationType.ABBREV);
	}

	public Faculty getFaculty() {
		return faculty;
	}

	public void setFaculty(Faculty faculty) {
		this.faculty = faculty;
	}

	public EducationForm getEducationForm() {
		return educationForm;
	}

	public void setEducationForm(EducationForm educationForm) {
		this.educationForm = educationForm;
	}

	public Integer getSemesterCount() {
		return semesterCount;
	}

	public void setSemesterCount(Integer semesterCount) {
		this.semesterCount = semesterCount;
	}

	public String getSpecialityCode() {
		return specialityCode;
	}

	public void setSpecialityCode(String specialityCode) {
		this.specialityCode = specialityCode;
	}

	public String getSpecialityCoding() {
		return specialityCoding;
	}

	public void setSpecialityCoding(String specialityCoding) {
		this.specialityCoding = specialityCoding;
	}

	public Set<Specialization> getSpecializations() {
		return specializations;
	}

	public void setSpecializations(Set<Specialization> specializations) {
		this.specializations = specializations;
	}
}